package com.xiongwei.mediator;

/**
 * @author XiongWei
 * @date 2024/2/1
 */
public class CoffeeMachine extends AbstractColleage{

    public CoffeeMachine(Mediator mediator, String name) {
        super(mediator, name);
        mediator.register(name, this);
    }

    @Override
    public void sendMessage(int stateChange) {
        getMediator().getMessage(stateChange, name);
    }

    public void startCoffee() {
        System.out.println("it`s time to make coffee");
    }

    public void finishCoffee() {
        System.out.println("coffee is ready");
        sendMessage(0);
    }
}
